package com.wjerp.tplus.server.domain.service.impl;

import com.wjerp.tplus.server.domain.entity.sys.PermissionInfo;
import com.wjerp.tplus.server.domain.entity.sys.UserPermission;
import com.wjerp.tplus.server.domain.mapper.UserPermissionMapper;
import com.wjerp.tplus.server.domain.service.UserPermissionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * @author lishuailei
 */
@Service
public class UserPermissionServiceImpl implements UserPermissionService {


    @Resource
    private UserPermissionMapper userPermissionMapper;

    @Override
    public List<UserPermission> findDefaultUserPermission() {

        return userPermissionMapper.findDefaultUserPermission();
    }

    @Override
    public void saveUserPermission(UserPermission userPermission) {
        userPermission.setCreatedTime(new Date());
        userPermissionMapper.insertSelective(userPermission);
    }

    @Override
    public List<PermissionInfo> findPermissionListByUserId(Long userId) {
        return userPermissionMapper.selectByUserId(userId);
    }
}
